Field of the Invention
The present invention relates to the field of unit testing of virtual machine components and, more particularly, to adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests.
Description of the Related Art
A number of languages, like JUNIT, exist expressly for conducting unit tests of software units configured to execute within a virtual machine environment, such as a JAVA VIRTUAL MACHINE (JVM). Unit testing can be valuable as it permits one or more software units to be tested throughout a software development cycle by simply executing a unit test program. When a software unit requires iterative testing during its lifecycle, an initial cost of constructing a unit test program can be considerably outweighed with long term savings gained throughout the software development cycle.
Black and white box testing of units using unit tests generally don't include tests for memory usage and/or performance. This is expressed in the JUNIT language by a lack of memory and/or performance related asserts. When unit tests include memory and/or performance checks, results are often less than perfect and writing the testing code can be challenging. Executing unit tests for memory and performance related information is difficult because needed information from a virtual machine is not currently exposed. For example, in the JUNIT API, there is no API access to the heap, there is no access to object size, there is no memory specific asserts, and there is no control over a garbage collector. Additionally, no information is available to access thread specific timers, to query a method invocation count, and no performance related asserts exist.